<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>ng-options 自动遍历option</title>
    <script src="../angular.js"></script>
</head>
<body>
    <div ng-app="gg" ng-controller="ctrl">
        <!--ng-options 构建slect表单列表-->
        <select ng-options="v.value as v.name for v in data" ng-model="uname">
            <option value="">--please select--</option>
        </select>
        {{uname}}
    </div>

    <script>
        var m = angular.module('gg', []);
        m.controller('ctrl', ['$scope', function ($scope) {
            $scope.uname = '果果';
            $scope.data = [
                {name : '果果', value : '21'},
                {name : '前程', value : '18'},
                {name : '小包子', value : '15'}
            ]
        }])
    </script>
</body>
</html>